package com.cn.aam.checaiduo.ui.more;

import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.cn.aam.checaiduo.R;
import com.cn.aam.checaiduo.base.BaseActivity;
import com.cn.aam.checaiduo.base.ToolBarManager;
import com.cn.aam.checaiduo.bean.other.BasicUserInfoB;
import com.cn.aam.checaiduo.ui.arouter.UIRouter;
import com.cn.aam.checaiduo.ui.arouter.section.RouterMore;
import com.cn.aam.checaiduo.utils.AuthUtil;
import com.cn.aam.checaiduo.utils.MyViewsUtils;

import butterknife.BindView;
import butterknife.OnClick;

@Route(path = UIRouter.MORE.AUTH_RESULT, name = "实名认证结果")
public class AuthResultActivity extends BaseActivity {
    public final static String DATA_BASIC_USER = "data_basic_user";


    @BindView(R.id.tv_name)
    TextView tvName;
    @BindView(R.id.tv_id_number)
    TextView tvIdNumber;
    @BindView(R.id.tv_mobile)
    TextView tvMobile;


    private BasicUserInfoB basicUserInfoB;
    private String name;
    private String IdNumber;
    private String mobile;



    @Override
    protected int layoutId() {
        return R.layout.activity_auth_result;
    }

    @Override
    protected void onGenerate() {
        basicUserInfoB = (BasicUserInfoB) getIntent().getSerializableExtra(DATA_BASIC_USER);
    }

    @Override
    protected void onResume() {
        super.onResume();
        name = basicUserInfoB.getReal_name();
        IdNumber = basicUserInfoB.getCard_id();
        mobile = basicUserInfoB.getMobile();
        renderViews();
    }

    @Override
    protected void initView() {
        //toolbar
        ToolBarManager.with(this, WMContent)
                .setBackgroundColor(R.color.colorPrimary)
                .setNavigationIcon(R.drawable.ic_nav_arrow_white)
                .setTitle("实名认证")
                .setTitleColor(R.color.white);

    }

    private void renderViews() {
        //real name
        tvName.setText(AuthUtil.hideFamilyName(name));
        //ID number
        tvIdNumber.setText(AuthUtil.hideIdNo(IdNumber));
        //mobile
        tvMobile.setText(AuthUtil.hideMobileNo(mobile));
    }

    @OnClick(R.id.btn_submit)
    public void onClick() {
        if (MyViewsUtils.isFastDoubleClick()) return;
        UIRouter.getInstance().getMore().openChangeMobileStep01(mContext,mobile);
    }
}
